﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using RayDen.Library.Core.Primitives;

namespace RayDen.Library.Components.Volume
{

    public interface IVoxel
    {

    }

    public struct VoxelData<TData> : IVoxel
    {
        public Point Position;
        public float Size;
        public TData Data;
    }


    public class VoxelGrid<TVoxelData>
    {
        public AABB Bounds;
        public ONB LocalFrame;

        private AbstractField<TVoxelData> grid;

        public VoxelGrid(int w, int h, int d, ONB basis)
        {
            grid = new AbstractField<TVoxelData>(w, h, d);
            this.LocalFrame = basis;
        }

        public void SetData(TVoxelData[] data, AABB bounds)
        {
            this.Bounds = bounds;
            grid.Fill(data);
        }

        public void GetGridCoordinate(float x, float y, float z, out Point p)
        {
            var a = new Vector(x, y, z);
            var localV = (Point)LocalFrame.ToLocal(ref a);




            p = new Point();
        }


    }
}
